import { createRouter, createWebHistory } from 'vue-router'

import LayoutView from '@/views/layout/index.vue'
import IndexView from '@/views/index/index.vue'
import ReportView from '@/views/report/index.vue'
import DeptView from '@/views/dept/index.vue'
import LogView from '@/views/log/index.vue'
import LoginView from '@/views/login/index.vue'
import MerchantView from '@/views/merchant/index.vue'
import EmpView from '@/views/emp/index.vue'
import UserView from '@/views/user/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
     path: '/', 
     name: '',
     component: LayoutView,
     redirect: '/index', //重定向
     children: [
      {path: 'index', name: 'index', component: IndexView},
      {path: 'report', name: 'report', component: ReportView},
      {path: 'dept', name: 'dept', component: DeptView},
      {path: 'log', name: 'log', component: LogView},
      {path: 'merchant', name: 'merchant', component: MerchantView},
      {path: 'emp', name: 'emp', component: EmpView},
      {path: 'user', name: 'user', component: UserView}
     ]
    },
    {path: '/login', name: 'login', component: LoginView}
  ]
})

export default router
